package cn.ym.ymcc.web.controller;

import cn.ym.ymcc.result.JSONResult;
import cn.ym.ymcc.service.IAliOssService;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.common.utils.BinaryUtil;
import com.aliyun.oss.model.MatchMode;
import com.aliyun.oss.model.PolicyConditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

@RestController
@RequestMapping("/oss")
public class AliOssController {

    @Autowired
    private IAliOssService aliOssService;

    @GetMapping("/sign")
    public JSONResult sign(){
        return JSONResult.success(aliOssService.sign());
    }

    @DeleteMapping("/delete/{fileName}")
    public JSONResult delete(@PathVariable("fileName") String fileName){
        aliOssService.delete(fileName);
        return JSONResult.success();
    }


}
